<h1>Usuários</h1>

<?php echo $this->Html->link('Adicionar Usuário', array('controller' => 'users', 'action' => 'add')); ?>

<p><?php echo '<strong>Total de Usuários Cadastrados: </strong>' . sizeof($users); ?></p>

<table>
	<tr>
		<th>Id</th>
		<th>Login</th>
		<th>Senha</th>
		<th>Acesso</th>
		<th>E-mail</th>
		<th>QR Code</th>
		<th>Data de Criação</th>
		<th>Data de Modificação</th>			
	</tr>
	
	<?php foreach ($users as $user): ?>
	
	<tr>
		<td><?php echo $user['User']['id']; ?></td>
		<td><?php echo $this->Html->link($user['User']['username'], array('controller' => 'users', 'action' => 'view', $user['User']['id'])); ?></td>
		<td><?php echo $user['User']['password']; ?></td>
		<td><?php echo $user['User']['role']; ?></td>
		<td><?php echo $user['User']['email']; ?></td>
		<td><img src="data:image/png;base64,<?php echo $user['User']['qrcode']; ?>" alt="QR Code" /></td>
		<td><?php echo $user['User']['created']; ?></td>
		<td><?php echo $user['User']['modified']; ?></td>
		<td><?php echo $this->Html->link('Editar', array('action' => 'edit', $user['User']['id'])); ?></td>
		<td><?php echo $this->Form->postLink('Apagar', array('action' => 'delete', $user['User']['id']), array('confirm' => 'Tem certeza de que deseja apagar o usuário?')); ?></td>
	</tr>
	
	<?php endforeach; ?>
</table>	 
	